package com.sjft.cloud.commons.support.datamodel.core.value;

import com.sjft.cloud.commons.core.func.Fn;
import com.sjft.cloud.commons.support.datamodel.enums.ModelFieldTypeEnum;
import com.sjft.cloud.commons.support.datamodel.core.ModelFieldValue;
import com.sjft.cloud.commons.support.datamodel.core.model.ImgUploadItem;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
public class MultiImgUploadValue implements ModelFieldValue<List<ImgUploadItem>> {

    private String type = ModelFieldTypeEnum.MULTI_IMG_UPLOAD_NAME;

    private List<ImgUploadItem> imgList = new ArrayList<>();

    public List<ImgUploadItem> getImgList() {
        if (Fn.isEmpty(imgList)) {
            imgList.add(new ImgUploadItem());
        }
        return imgList;
    }

    @Override
    public List<ImgUploadItem> getValue() {
        return imgList;
    }
}
